<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> 

<%-- S 一般处理 --%>
<c:if test="${filterInfo.headType=='General'}">
<div class="col-md-3 col-sm-4">
    <%-- 定义变量 --%>
    <c:set var="isSingle" value="${fn:length(filterInfo.values)==1}" scope="page"/>
    <c:set var="isMulti" value="${fn:length(filterInfo.values)>1}" scope="page"/>
    
    <div class="input-group input-group-sm js_filter_common">
        <%-- S 单数据处理 --%>
        <c:if test="${isSingle}">
            <c:forEach items="${filterInfo.values}" var="value">
	            <c:set var="isLike" value="" />
	          	<c:if test="${value.condition=='Like'}" >
	          		<c:set var="isLike" value="(模糊)" />
	          	</c:if>
	            <input name="${value.name}" type="text" class="form-control" placeholder="输入${value.comment}"/>
	            <span class="input-group-btn">
	                <button class="btn btn-default js_filterButtonClick" tabindex="-1" type="button">
	                	<span class="glyphicon glyphicon-search"></span> 查询
	                </button>
	            </span>
            </c:forEach>
        </c:if>
        <%-- E 单数据处理 --%>
        
        <%-- S 多数据处理 --%>
        <c:if test="${isMulti}">
			<c:set var="isLike" value="" />
           	<c:if test="${filterInfo.values[0].condition=='Like'}" >
           		<c:set var="isLike" value="(模糊)" />
           	</c:if>
            <input type="text" class="form-control js_text" name="${filterInfo.values[0].name}" placeholder="输入${filterInfo.values[0].comment}${isLike}" >
            <span class="input-group-btn">
                <button type="button" class="btn btn-default js_filterButtonClick" tabindex="-1">
                	<span class="glyphicon glyphicon-search"></span> 查询
                </button>
                <button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" tabindex="-1">
					<span class="caret"></span>
					<span class="sr-only">Toggle Dropdown</span>
                </button>
                <ul class="dropdown-menu dropdown-menu-right small" role="menu" >
                <c:forEach items="${filterInfo.values}" var="value">
                	<c:set var="isLike" value="" />
                	<c:if test="${value.condition=='Like'}" >
                		<c:set var="isLike" value="(模糊)" />
                	</c:if>
                    <li inputName="${value.name}" inputComment="${value.comment}${isLike}" onclick="js_filter_mutilCommon(this)"><a href="javascript:void(0)">按${value.comment}查询${isLike}</a></li>
                </c:forEach>
                </ul>
			</span>
            
            <script type="text/javascript">
                function js_filter_mutilCommon(thisTarget){
                	$(thisTarget).closest(".js_filter_common")
                		.find(".js_text")
                    	.attr("name", $(thisTarget).attr("inputName"))
                    	.attr("placeholder", "输入"+$(thisTarget).attr("inputComment"))
                }
            </script>
        </c:if>
        <%-- E 多数据处理 --%>
    </div>
</div>
</c:if>
<%-- E 一般处理 --%>
    